package com;

import java.util.Scanner;

public class Demo01 {
    //已知一个数组arr {19,28,37,46,50}
    //键盘录入一个数据 查找该数据在数组中的索引，并在控制台输出找到索引值
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入（19,28,37,46,50）查看对应的索引值：");
        int num = sc.nextInt();
        int index = -1;
        int []arr = {19,28,37,46,50};
        for(int i = 0;i<arr.length;i++){
            if(arr[i]==num){
                index = i;
                break;
            }
        }
        System.out.println("索引值为"+index);
    }
}
